using System.Collections.Generic;
using IQIGame.Onigao.Framework.Serialization;
using IQIGame.Onigao.GamePlay;
using IQIGame.Onigao.Framework;

namespace IQIGame.Onigao.Logic
{
    public sealed partial class BattleCommand_StartPart
    {
        public override void Serialize(SOutputStream _buf)
        {
            base.Serialize(_buf);
            _buf.Write_long(this.partGUID);
            _buf.Write_int(this.skillID);
            _buf.Write_int(this.aiMoveType);
            _buf.Write_boolean(this.targetGUID != null);
            if (this.targetGUID != null)
            {
               _buf.Write_int(this.targetGUID.Length);
               for (int i = 0; i < this.targetGUID.Length; i++)
               {
                   SerializeCustomPODUtil.SerializeListInt(_buf, this.targetGUID[i]);
               }
            }
            this.OnSerialize(_buf);
        }

        public override void DeSerialize(SInputStream _buf)
        {
            base.DeSerialize(_buf);
            this.partGUID = _buf.Read_long();
            this.skillID = _buf.Read_int();
            this.aiMoveType = _buf.Read_int();
            var bNotNull = _buf.Read_boolean();
            if (bNotNull)
            {
               this.targetGUID = new List<int>[_buf.Read_int()];
               for (int i = 0; i < this.targetGUID.Length; i++)
               {
                   SerializeCustomPODUtil.DeSerializeListInt(_buf, ref this.targetGUID[i]);
               }
            }
            this.OnDeSerialize(_buf);
        }
    }
}
